Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@loaders.gl/core
Advanced tools
@loaders.gl/core is a framework-agnostic library for loading and processing data in various formats. It provides a unified API for handling different types of data sources, making it easier to work with complex data pipelines.
Loading Data
This feature allows you to load data from various sources using different loaders. In this example, the CSVLoader is used to load a CSV file from a URL.
const { load } = require('@loaders.gl/core');
const { CSVLoader } = require('@loaders.gl/csv');
async function loadData(url) {
const data = await load(url, CSVLoader);
console.log(data);
}
loadData('https://example.com/data.csv');
Parsing Data
This feature allows you to parse data from a string or buffer using different parsers. In this example, the JSONLoader is used to parse a JSON string.
const { parse } = require('@loaders.gl/core');
const { JSONLoader } = require('@loaders.gl/json');
async function parseData(jsonString) {
const data = await parse(jsonString, JSONLoader);
console.log(data);
}
parseData('{"key": "value"}');
Creating Custom Loaders
This feature allows you to create and register custom loaders for handling specific data formats. In this example, a CustomLoader is created and registered to load data from a custom format.
const { registerLoaders, Loader } = require('@loaders.gl/core');
class CustomLoader extends Loader {
parse(arrayBuffer) {
// Custom parsing logic
return { data: new Uint8Array(arrayBuffer) };
}
}
registerLoaders([new CustomLoader()]);
async function loadCustomData(url) {
const data = await load(url, CustomLoader);
console.log(data);
}
loadCustomData('https://example.com/data.custom');
PapaParse is a powerful CSV parser that can handle large files and various edge cases. It is specifically designed for parsing CSV data, whereas @loaders.gl/core provides a more general framework for loading and parsing multiple data formats.
Axios is a popular HTTP client for making requests to fetch data from URLs. While it focuses on making HTTP requests, @loaders.gl/core provides a higher-level abstraction for loading and parsing data from various sources.
d3-dsv is a module from the D3.js library that provides functions for parsing and formatting delimiter-separated values (DSV) files. It is specialized for DSV formats, whereas @loaders.gl/core supports a wider range of data formats and provides a unified API.
This module contains shared utilities for loaders.gl, a collection of framework independent 3D and geospatial loaders (parsers).
v0.6.2
FAQs
The core API for working with loaders.gl loaders and writers
The npm package @loaders.gl/core receives a total of 209,765 weekly downloads. As such, @loaders.gl/core popularity was classified as popular.
We found that @loaders.gl/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.